import { EntityBasePoint } from "./EntityBasePoint";
import { EEntityType } from "../../../../../Message/Public/EEntityType";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GameMapUtil } from "../../../scene/map/GameMapUtil";
import { Cache } from "../../../cache/Cache";
import { SEntityInfo } from "../../../../../Message/BroadCast/SEntityInfo";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
//class EntityPoint
    
    export  class EntityPoint extends EntityBasePoint
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ updatePointView(): void
        {
            var loc1=false;
            if (this._entityInfo) 
            {
                var loc2=this._entityInfo.entityId.type;
                switch (loc2) 
                {
                    case EEntityType._EEntityTypeTransport: case EEntityType._EEntityTypeEscort:
                    {
                        _bitMap.bitmapData = GlobalClass.getBitmapData(ImagesConst.MapUITransport);
                        break;
                    }
                    case EEntityType._EEntityTypePlayer:
                    {
                        loc1 = true;
                        if (GameMapUtil.isArena() && !Cache.instance.arena.isTeammate(this._entityInfo.entityId) || GameMapUtil.curMapState.isArenaCross || GameMapUtil.curMapState.isWrestle || GameMapUtil.curMapState.isGangFights && !Cache.instance.gangFights.isTeammate(this._entityInfo.entityId)) 
                        {
                            loc1 = false;
                        }
                        if (loc1) 
                        {
                            _bitMap.bitmapData = GlobalClass.getBitmapData(ImagesConst.MapUIFriend);
                        }
                        else 
                        {
                            _bitMap.bitmapData = GlobalClass.getBitmapData(ImagesConst.MapUIArenaEnemy);
                        }
                        break;
                    }
                }
                _bitMap.x = (-_bitMap.width) / 2;
                _bitMap.y = (-_bitMap.height) / 2;
            }
            return;
        }

        protected /* override */ updateObj(arg1: Object): void
        {
            if (typeof arg1 === "sentityinfo") 
            {
                this._entityInfo = arg1 as SEntityInfo;
                _entityId = this._entityInfo.entityId;
            }
            return;
        }

        public /* override */ dispose(): void
        {
            super.dispose();
            this._entityInfo = null;
            return;
        }

        public /* override */ get toolTipData()
        {
            if (this._entityInfo != null) 
            {
                return HTMLUtil.addColor(this._entityInfo.name, "#00ff00");
            }
            return;
        }

        protected /* var */_entityInfo: SEntityInfo;
    }
